package com.hyf.dagger2;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.hyf.dagger2.app.Dagger2Application;
import com.hyf.dagger2.base.BaseActivity;
import com.hyf.dagger2.constant.UserInfo;
import com.hyf.dagger2.presenter.MainPresenter;
import com.hyf.dagger2.ui.NoPresenterActivity;

import javax.inject.Inject;

public class MainActivity extends BaseActivity<MainPresenter> {

    @Inject
    UserInfo userInfo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void clickButton01(View view) {
        Toast.makeText(this, Dagger2Application.getAppComponent().getContext().toString(), Toast.LENGTH_SHORT).show();
    }

    public void clickButton02(View view) {
        Toast.makeText(this, presenter.say(), Toast.LENGTH_SHORT).show();
    }

    public void clickButton03(View view) {
        startActivity(new Intent(this, NoPresenterActivity.class));
    }

    public void clickButton04(View view) {
        Toast.makeText(this, userInfo.string(), Toast.LENGTH_SHORT).show();
    }
}
